package com.shuyun.springdata.showcase.controller;

import com.shuyun.springdata.showcase.domain.Person;
import com.shuyun.springdata.showcase.service.PersonService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by feng.ding on 2017/1/9.
 */
@RestController
public class CacheController {

    @Autowired
    private PersonService personService;

    @RequestMapping("/put")
    public Person save(Person person){
        return personService.save(person);
    }

    @RequestMapping("/one")
    public Person one(Person person){
        return personService.findOne(person);
    }

    @RequestMapping("/delete")
    public String delete(Long id){
        personService.remove(id);
        return "OK";
    }
}
